/*
 ------------------------------------------------------------------------------
 Copyright (C) 2006-2007 Team Blur.

 This file is part of the Quantum Engine source code.

 The Quantum Engine source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The Quantum Engine source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the Quantum Engine source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


#ifndef __SG_LOCAL_H__
#define __SG_LOCAL_H__


#include "../game.h"
#include "sg_public.h"
#include "sg_dict.h"
#include "sg_client.h"
#include "sg_entity.h"
#include "sg_clip.h"


#define IP_FILTERS_FILE					"banIPs.cfg"

#define MAX_IP_FILTERS					1024

typedef struct {
	int						time;

	bool					spawned;

	int						snapshotCount;

	const char *			ipFilters[MAX_IP_FILTERS];

	const char *			configStrings[MAX_CONFIG_STRINGS];

	client_t *				clients[MAX_CLIENTS];
	entity_t *				entities[MAX_ENTITIES];
} levelLocals_t;

extern levelLocals_t		level;

extern sgExport_t			sge;
extern sgImport_t *			sgi;

extern cvar_t *				sg_gameName;
extern cvar_t *				sg_gameDate;
extern cvar_t *				sg_protocol;
extern cvar_t *				sg_timeLimit;
extern cvar_t *				sg_friendlyFire;
extern cvar_t *				sg_filterBan;

void				SG_ParseBanIPs (void);
bool				SG_FilterIP (const char *ip);

void				SG_AddGameCommands (void);
void				SG_RemoveGameCommands (void);

void				SG_SetupEditorLights (void);

void				SG_InitLightEditor (void);
void				SG_ShutdownLightEditor (void);

bool				SG_SpawnEntity (entity_t *entity, script_t *script);

void				SG_SetConfigString (int index, const char *string);

int					SG_AnimationIndex (const char *name);
int					SG_ModelIndex (const char *name);
int					SG_ClipModelIndex (const char *name);
int					SG_MaterialIndex (const char *name);
int					SG_MaterialLightIndex (const char *name);
int					SG_MaterialNoMipIndex (const char *name);
int					SG_SoundShaderIndex (const char *name);

void				SG_WriteSnapshotToClient (client_t *client, ByteBuffer *msg);


#endif	// __SG_LOCAL_H__
